#Project Aim

There is a continued need to improve immunization coverage rates. Recent polls of adults suggest that as few as 50% of US adults are committed to receiving a COVID-19 vaccine, and misinformation and conspiracy theories about a vaccine abound. Prematurely approving a vaccine could undermine COVID-19 vaccination efforts and erode confidence in vaccines more generally (Bauchner et al., 2020). There is great concern given the flurry of public announcements from sources (such as the FDA, CDC, Pfizer, The White House etc.) that have made several announcements on soon to be vaccine COVID-19 availability. Alongside Operation Warp Speed, these announcements have left clinicians, public health officials, and members of the public bewildered about what is happening and concerned that vaccines will be made available before safety and effectiveness are fully established.

In this project we set out to understand population beliefs about vaccines in general and the drivers that influence their decisions. We aimed at answering the following questions: How do knowledge and beliefs about vaccines vary by age,race SES, income,education, location. Does it matter who is telling me about vaccines (e.g., doctors vs internet. How does insurance coverage, type of doctor,predict vaccine acceptance.What are the charcteristics of vaccine hesitant groups.

##Links to the data sets:

###Insurance as Predictor of Vaccine Exemption

Among exemptors,respondents with no insurance were more likely to have requested a non medical exemption.There are no significant differences between those holding Private and Public Insurance.

###Race as Predictor of Vaccine Exemption A person’s race did not predict getting a non medical exemption. There are no significant differences between races,peopl who identify as other race were significant minority among the total respondents.

###Type of Doctor as Predictor of Vaccine Exemption

Respondents without a doctor and those who visited a Naturopath were more likely to request a non-medical exemption.

####Combined Plots

Respondent Characteristics by Vaccine Exemption Status

#Trial #Reasons for Exemption

## `summarise()` regrouping output by 'ExemptReason' (override with `.groups` argument)

Concern Regarding Vaccine Safety
EverExempt Extremely Concerned Not at all Concerend Not Concerned Not Sure Some what Concerned
No 15.1 10.4 32.6 12.4 29.5
Yes 69.5 5.3 2.1 23.2
Concern Regarding Vaccine Side Effects
EverExempt Extremely Concerned Not at all Concerend Not Concerned Not Sure Some what Concerned
No 13.8 9.4 30.2 7.4 39.3
Yes 60.0 1.1 4.2 6.3 28.4
Concern Regarding Vaccine Preventing serious Diseases
EverExempt Extremely Concerned Not at all Concerend Not Concerned Not Sure Some what Concerned
No 9.7 16.1 39.9 14.1 20.1
Yes 36.8 5.3 9.5 15.8 32.6

####SES,Age,Source of Information,Social Media in Vaccine Acceptance

Survey_Summary<-read_excel(("Survey_Summary.xlsx"))

Survey_Summary <-slice(Survey_Summary,2:n())

vac_bev_sm <- Survey_Summary %>%
  select(6, 7, 8, 9, 10, 11,13,15, 16)

vac_bev_sm <- rename(vac_bev_sm,
Age = "What is your age?",Gender = "What is your gender?", 
Continent = "Which continent do you live on?",
Education = "What is the highest level of education you have completed?", 
SES = "What socioeconomic class would you consider yourself/ your family?", 
SM_preference = "Which form of social media do you use most?", 
SM_Hrs_day = "In a typical day, how many hours do you spend on social media?",
Influene_ofSM_Info = "Information about vaccines seen on social media has:",
Most_trusted_with_Immunization_Info =
  "Who do you trust most with immunization related information/ decisions?")

vac_bev_USA <- vac_bev_sm %>% 
  filter(Continent == "North America, United States"|
           Continent == "North America, Other") %>%
   mutate(Continent = case_when(
     Continent %in% c("North America, United States") ~ "NA USA",
     Continent %in% c("North America, Other") ~ "NA Other"))
#table(vac_bev_USA$Education)
vac_bev_USA <- vac_bev_USA %>%
  mutate(Education = case_when(
    Education %in% c("Associates Degree (2 year college/university degree)") ~ "AS",
    Education %in% c("Elementary school (grade level 1-8)") ~ "Elem",
    Education %in% c("Master's Degree") ~ "MD",
    Education %in% c("Professional/Doctoral Degree (PhD, MD, DC etc..") ~ "DD",
    Education %in% c("Bachelor Degree (4 year college/university degree)") ~ "BD",
    Education %in% c("High school (grade level 9-12/13)") ~ "HS",
    Education %in% c("No formal schooling") ~ "None",
    TRUE ~ NA_character_))

#table(vac_bev_USA$Influene_ofSM_Info)

vac_bev_USA <- vac_bev_USA %>%
  mutate(Influene_ofSM_Info = case_when(
    Influene_ofSM_Info %in% c("I have not seen anything about vaccines on social media") ~ "No Info seen",
    Influene_ofSM_Info %in% c("Influenced my opinion on vaccines (vaccines are better then I thought previously)") ~ "Positive",
    Influene_ofSM_Info %in% c("Influenced my opinion on vaccines (vaccines are worse then I thought previously)") ~ "Negative",
    Influene_ofSM_Info %in% c("NOT influenced my opinion on vaccines") ~ "None"))

#table(vac_bev_USA$SES)
vac_bev_USA$Age <-as.factor(vac_bev_USA$Age)

####Vaccine Beliefs By Education,SES,Social Media Influence Across Different Age Groups

# How do knowledge and beliefs about vaccines vary by age, SES, education, location:
 
vac_tab <- vac_bev_USA %>%
  mutate(count= 1) %>%
  select( Age,Education, SES,Influene_ofSM_Info, Most_trusted_with_Immunization_Info, count ) %>%
  drop_na() %>%
  group_by(Age,Education,SES,Influene_ofSM_Info) %>%
  summarize( Count = n() ) 
  data.frame()
## data frame with 0 columns and 0 rows
  vac_bev_tablewide <- vac_tab %>%
  pivot_wider(names_from = c(Age), values_from = Count) %>%
  drop_na()
 # Created a formatted table 
  opts<-options(knitr.kable.NA="-")
kable( vac_bev_tablewide,longtable=T,booktabs=T, col.names=c("Education Level","Social Economic Status", "Influence of SM","18-24","25-34", "35-44","45-54","55-64","65+")) %>%
  #caption=" The “Anti-Vax” Movement - Social Media (SM) Influence on Knowledge and Trends of Vaccinations - North America, 2017-2018") %>%
  kable_styling(full_width=F) %>%
  kable_styling(position="left") %>%
  kable_styling(font_size=10) %>%
  add_header_above(c(" "=3,"Age Group Surveyed" =6))%>%
  column_spec(1:3, bold=TRUE) %>%
  column_spec(1:9, width="1cm") %>%
  column_spec(3:9, color= if_else(vac_bev_tablewide$Influene_ofSM_Info=="Positive", "Red","green", "green"))%>%
  pack_rows("Associate Degree",1,3)%>%
  pack_rows("Bachelors Degree",4,7)%>%
  pack_rows("High School Degree",8,10)%>%
  pack_rows("Masters Degree",11,12)%>%
  collapse_rows(columns=1, valign="top") %>%
  footnote(
  general="Benoit, Staci L. The “Anti-Vax” Movement: A Quantitative Report on Vaccine Beliefs and Knowledge across Social Media¿: Survey Summary.xlsx. Ann Arbor, MI: Inter-university Consortium for Political and Social Research [distributor], 2020-08-03. https://doi.org/10.3886/E120505V1-44300. ",
  general_title="Reference and Data Source ")
Age Group Surveyed
Education Level Social Economic Status Influence of SM 18-24 25-34 35-44 45-54 55-64 65+
Associate Degree
AS Middle Class No Info seen 1 3 4 7 6 3
Middle Class None 54 81 69 63 31 11
Middle Class Positive 10 18 9 4 3 1
Bachelors Degree
BD Lower Class None 4 10 8 1 3 1
Middle Class Negative 4 11 7 4 1 2
Middle Class None 71 169 119 63 29 9
Middle Class Positive 13 26 20 7 3 1
High School Degree
HS Lower Class None 14 19 12 6 3 2
Middle Class No Info seen 7 4 1 9 6 5
Middle Class None 75 43 35 41 18 12
Masters Degree
MD Middle Class None 8 61 59 36 15 9
Middle Class Positive 2 7 5 5 4 1
Reference and Data Source
Benoit, Staci L. The “Anti-Vax” Movement: A Quantitative Report on Vaccine Beliefs and Knowledge across Social Media¿: Survey Summary.xlsx. Ann Arbor, MI: Inter-university Consortium for Political and Social Research [distributor], 2020-08-03. https://doi.org/10.3886/E120505V1-44300.

####Proportions by Gender Surveyed

#Proportion of gender: count per category
vac_bev_plot <- vac_bev_USA %>%
  mutate(count= 1) %>%
  select( Gender, count ) %>%
  drop_na() %>%
  group_by(Gender) %>%
  summarize( num = n() ) 

vac_bev_plot$total <- sum( vac_bev_plot$num)
vac_bev_plot$prop <- vac_bev_plot$num / vac_bev_plot$total
#sum ( vac_bev_plot$prop ) 

vac_bev_plot <- vac_bev_plot %>%
  mutate(Gender = factor(Gender,
                         levels = Gender[order( num)]))

vac_bev_plot$perc <- as.character(round(vac_bev_plot$prop, 3 ) * 100 )
vac_bev_plot$lab <- paste(vac_bev_plot$num,
                          paste( " (", vac_bev_plot$perc, "%", sep = ""),
                          sep = "", ")")

ggplot(vac_bev_plot, aes( x = Gender, y = prop ) ) +
  geom_bar( stat = "identity", width = 0.3 ) +
  coord_flip() +
  ylim( 0 , 1 ) +
  geom_text( aes( x = Gender, y = prop, label = lab ),
             size = 3.5, vjust = .5, hjust = -.3 ) +
  labs(x = "Gender",
       y = "Proportion",
       title = "Gender Proportion",
       subtitle = "Proprotion by Gender surveyed") +
  theme_solarized()

####Social Media Influence on Vaccination

People between the ages of 25 and 54 and with Associate’s degree and higher were more likely to be influenced by social media platforms like Facebook.

vac_bev_plot2 <- vac_bev_USA %>%
  mutate(count= 1) %>%
  select( Age, SM_preference, count ) %>%
  drop_na() %>%
  group_by(Age, SM_preference) %>%
  summarize( num = n() ) 

vac_bev_plot2$total <- sum( vac_bev_plot2$num)
vac_bev_plot2$prop <- vac_bev_plot2$num / vac_bev_plot2$total
#sum ( vac_bev_plot2$prop )


plot_ly(
  vac_bev_plot2,
  x= ~SM_preference,
  y= ~prop,
  color= ~Age,
  type="bar"
) %>%
  layout(title="Vaccination Trends by Scocial Media Influence, 2001-2018",
    yaxis=list(title="Proportion by Age"),
    xaxis=list(title="Social Media Preference"),
    paper_bgcolor="azure",
    plot_bgcolor="white"
  )

Resources for Vaccination Information

Doctors are the most trusted source of information regarding Vaccine Information

#Does it matter who is telling me about vaccines (e.g., doctors vs internet)?
vac_bev_plot3 <- vac_bev_USA %>%
  mutate(count= 1) %>%
  select(Influene_ofSM_Info,Most_trusted_with_Immunization_Info, count ) %>%
  drop_na() %>%
  group_by(Influene_ofSM_Info, Most_trusted_with_Immunization_Info) %>%
  summarize( Count = n() )


vac_bev_plot3 <- vac_bev_plot3 %>%
  mutate(Most_trusted_with_Immunization_Info = factor(Most_trusted_with_Immunization_Info,
                         levels = Most_trusted_with_Immunization_Info[order( Count)]))

vac_bev_plot3$total <- sum( vac_bev_plot3$Count)
vac_bev_plot3$prop <- vac_bev_plot3$Count / vac_bev_plot3$total

vac_bev_plot3$perc <- as.character(round(vac_bev_plot3$prop, 3 ) * 100 )
  vac_bev_plot3$lab <- paste(vac_bev_plot3$Count,
                          paste( " (", vac_bev_plot3$perc, "%", sep = ""),
                          sep = "", ")")

 plot_ly(
   vac_bev_plot3,
   x= ~Most_trusted_with_Immunization_Info,
  y= ~prop,
  color= ~Most_trusted_with_Immunization_Info,
  type="bar"
) %>%
  layout(barmode="stack",
           title="Resources most trusted with Vaccination Information",
    yaxis=list(title="Proportion"),
    xaxis=list(title=""),
    paper_bgcolor="azure",
    plot_bgcolor="white"
  )

####Need for Immunization

Most of the survey participants understood that vaccines are needed to achieve herd immunity to protect people who cannot be vaccinated

vac_bev_all <- Survey_Summary %>%
  select(7, 18, 19, 21, 22, 23, 26,28)

 vac_bev_all <- rename(vac_bev_all,
Gender = "What is your gender?",
RareDz_No_vac_req = "Most diseases are so rare that they no longer require vaccination.",
Herd_Immunity_needed = "Immunization of large portions of the population is needed in order to protect immunocompromised individuals (people who cannot receive vaccines).")

 vac_bev_plot28 <- vac_bev_all %>%
  mutate(count= 1) %>%
  select(Gender, RareDz_No_vac_req,Herd_Immunity_needed,count ) %>%
  drop_na()%>%
  group_by( Gender, Herd_Immunity_needed) %>%
  summarize( Count = n() )

vac_bev_plot18 <- vac_bev_all %>%
  mutate(count= 1) %>%
  select(RareDz_No_vac_req,Herd_Immunity_needed,count ) %>%
  drop_na()%>%
  group_by(RareDz_No_vac_req) %>%
  summarize( Count = n() )

ggplot( vac_bev_plot28, aes(x=Herd_Immunity_needed,y=Count)) +
  geom_bar(aes(fill="Count"), stat="identity")+
  scale_y_continuous(labels = function(x) format(x,big.mark=",",scientific=FALSE)) +
  scale_fill_manual(name="Herd Immunity Needed",values=c("coral","cyan2")) +
  # scale_fill_manual(name="Answers",values=rainbow(2))
  labs(x="",y="Population Count",title="Need to Immunize large populations",caption=" Protects people who cannot receive vaccines.") +
  theme(legend.position="bottom")

Does Income Status Predict Vaccine Hesitany

Vaccine hesistancy does not depend on income status. Vaccine hesitancy looks to be evenly distrubuted across the different Income levels.

vaccine_new <- select(df_1, c(TrustInfo, SeriousSE, NaturalImmunity,Hesitant, ExemptReason, Income, Educ))

#vaccine_new <- vaccine_new[-1,]
ses<- vaccine_new %>%
  drop_na(Hesitant, Income)%>%
  group_by(Hesitant, Income) %>%
  summarise(Total= n())
## `summarise()` regrouping output by 'Hesitant' (override with `.groups` argument)
ses_graph<- ggplot(ses, aes(x=Hesitant,
                            y=Total,
                            fill= Income))
ses_graph<-ses_graph+geom_bar(stat = "identity") 
ses_graph <- ses_graph + labs(x= "Vaccine Hesitance", title= "Vaccine Hesitancy and Income")

ses_graph

####SocioEconomic Characteristics with Hesitancy and Exempt Reasons

ses_table <- vaccine_new %>%
  select(Hesitant,Income, Educ,ExemptReason) %>%
  drop_na() 

datatable(ses_table,
          options = list(
            columnDefs=list(
              list(className='dt-center')
            )
          ),
          rownames=FALSE,
          colnames=c("Hesitant","Income","Education","Exempt Reason"),
          caption=" Social Economic Status Characteristics with Hesitancy and Exempt Reasons")

#####References: 1- Parental attitudes and perceptions associated with childhood vaccine exemptions in high-exemption schools. (n.d.). Retrieved November 29, 2020, from https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0198655

2- Benoit, S. L. (2020). The “Anti-Vax” Movement: A Quantitative Report on Vaccine Beliefs and Knowledge across Social Media [Data set]. Inter-university Consortium for Political and Social Research (ICPSR). https://doi.org/10.3886/E120505V1